package com.douqu.game.core.database.model;

import java.util.Date;

/**
 * Created by bean on 2017/7/18.
 */
public class ServerModel {

    private int id;

    private String name;

    private int playerIndex;

    private int goodsIndex;

    private String authServerHost;

    private int freeCount;

    private int crowdCount;

    private int fullCount;

    private Date createTime;

    private byte[] worldInfo;

    /**
     * 单人战场数据
     */
    private byte[] playerWorldMapInfo;

    /**
     * 检测人数
     * @return
     */
    public boolean checkServerStatusCount()
    {
        if(freeCount < 0 || crowdCount <= 0 || fullCount <= 0 || freeCount == fullCount || freeCount == crowdCount || fullCount == crowdCount)
            return false;

        if(freeCount > crowdCount || freeCount > fullCount || crowdCount > fullCount)
            return false;

        return true;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getPlayerIndex() {
        return playerIndex;
    }

    public void setPlayerIndex(int playerIndex) {
        this.playerIndex = playerIndex;
    }

    public byte[] getWorldInfo() {
        return worldInfo;
    }

    public void setWorldInfo(byte[] worldInfo) {
        this.worldInfo = worldInfo;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }


    public String getAuthServerHost() {
        return authServerHost;
    }

    public void setAuthServerHost(String authServerHost) {
        this.authServerHost = authServerHost;
    }


    public int getFreeCount() {
        return freeCount;
    }

    public void setFreeCount(int freeCount) {
        this.freeCount = freeCount;
    }

    public int getCrowdCount() {
        return crowdCount;
    }

    public void setCrowdCount(int crowdCount) {
        this.crowdCount = crowdCount;
    }

    public int getFullCount() {
        return fullCount;
    }

    public void setFullCount(int fullCount) {
        this.fullCount = fullCount;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getGoodsIndex() {
        return goodsIndex;
    }

    public void setGoodsIndex(int goodsIndex) {
        this.goodsIndex = goodsIndex;
    }

    public byte[] getPlayerWorldMapInfo() {
        return playerWorldMapInfo;
    }

    public void setPlayerWorldMapInfo(byte[] playerWorldMapInfo) {
        this.playerWorldMapInfo = playerWorldMapInfo;
    }

    @Override
    public String toString() {
        return "{" +
                "id=" + id +
                ", playerIndex=" + playerIndex +
//                ", battleServerHost='" + battleServerHost + '\'' +
                ", authServerHost='" + authServerHost + '\'' +
                ", freeCount=" + freeCount +
                ", crowdCount=" + crowdCount +
                ", fullCount=" + fullCount +
                ", createTime=" + createTime +
                '}';
    }
}
